package us.mmapp.entities;

import org.json.JSONException;
import org.json.JSONObject;

public class FriendEntity
{
	public enum FriendState {ACCEPTED, PENDING, AWAITING}
	private String username;
	private long uid;
	private FriendState state;
	
	public FriendEntity(JSONObject json)
	{
		try
		{
			uid = json.getLong("uid");
			int status = json.getInt("status");
			switch (status)
			{
			case 1: state = FriendState.ACCEPTED; break;
			case 2: state = FriendState.PENDING; break;
			case 3: state = FriendState.AWAITING; break;
			}
			username = json.getString("username");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void setUsername(String username)
	{
		this.username = username;
	}
	public String getUsername()
	{
		return username;
	}
	public void setUid(long uid)
	{
		this.uid = uid;
	}
	public long getUid()
	{
		return uid;
	}
	public void setState(FriendState state) {
		this.state = state;
	}
	public FriendState getState() {
		return state;
	}
}
